package com.xinsoft.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinsoft.common.CountBean;
import com.xinsoft.entity.dto.ScmSaleOutstockParam;
import com.xinsoft.entity.po.ScmSaleOutstock;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinsoft.entity.vo.ScmSaleOutstockListVo;
import com.xinsoft.entity.vo.ScmSaleOutstockVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author ZYM
* @description 针对表【scm_sale_outstock(销售出库)】的数据库操作Mapper
* @createDate 2023-07-20 15:20:16
* @Entity com.xinsoft.entity.po.ScmSaleOutstock
*/
public interface ScmSaleOutstockMapper extends BaseMapper<ScmSaleOutstock> {

    IPage<ScmSaleOutstockListVo> findPageListByParam(Page<ScmSaleOutstockListVo> page,@Param("param") ScmSaleOutstockParam param);
    List<ScmSaleOutstockListVo> findPageListByParam(@Param("param") ScmSaleOutstockParam param);

    ScmSaleOutstockVo getOutStockById(Integer id);

    /**
     * 获取被销售退货引用的数量
     * @param id 销售出库id
     * @return int
     */
    int getSaleReturnCiteCount(Integer id);

    /**
     * 获取销售出库中已用的源单物料数量
     * @param sourceIds  源单ids
     * @param sourceType 源单类型
     */
    List<CountBean> getUsedCountOfSaleOutstock(@Param("sourceIds") List<Integer> sourceIds, @Param("sourceType") Integer sourceType);
}




